﻿using RB.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data.Common;
using System.Collections.Specialized;

namespace RB.DataAccess.Testing
{
    
    
    /// <summary>
    ///这是 DataContextTest 的测试类，旨在
    ///包含所有 DataContextTest 单元测试
    ///</summary>
    [TestClass()]
    public class DataContextTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///获取或设置测试上下文，上下文提供
        ///有关当前测试运行及其功能的信息。
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region 附加测试特性
        // 
        //编写测试时，还可使用以下特性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///Default 的测试
        ///</summary>
        [TestMethod()]
        public void DefaultTest()
        {
            DataContext actual;
            actual = DataContext.Default;
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///DataContexts 的测试
        ///</summary>
        [TestMethod()]
        public void DataContextsTest()
        {
            DataContextCollection actual;
            actual = DataContext.DataContexts;
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///ConnectionTotalCount 的测试
        ///</summary>
        //[TestMethod()]
        //public void ConnectionTotalCountTest()
        //{
        //    int actual;
        //    actual = DataContext.ConnectionTotalCount;
        //    Assert.Inconclusive("验证此测试方法的正确性。");
        //}

        internal virtual DataContext CreateDataContext()
        {
            // TODO: 实例化相应的具体类。
            DataContext target = new RB.DataAccess.SqlServer.MsSqlDataContext();
            return target;
        }

        /// <summary>
        ///ConnectionString 的测试
        ///</summary>
        [TestMethod()]
        public void ConnectionStringTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            string actual;
            actual = target.ConnectionString;
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///ConnectionPeakCount 的测试
        ///</summary>
        //[TestMethod()]
        //public void ConnectionPeakCountTest()
        //{
        //    int actual;
        //    actual = DataContext.ConnectionPeakCount;
        //    Assert.Inconclusive("验证此测试方法的正确性。");
        //}

        /// <summary>
        ///ConnectionCount 的测试
        ///</summary>
        //[TestMethod()]
        //[DeploymentItem("RB.DataAccess.dll")]
        //public void ConnectionCountTest()
        //{
        //    int expected = 0; // TODO: 初始化为适当的值
        //    int actual;
        //    DataContext_Accessor.ConnectionCount = expected;
        //    actual = DataContext_Accessor.ConnectionCount;
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("验证此测试方法的正确性。");
        //}

        /// <summary>
        ///OpenConnection 的测试
        ///</summary>
        //[TestMethod()]
        //public void OpenConnectionTest()
        //{
        //    DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
        //    DbConnection expected = null; // TODO: 初始化为适当的值
        //    DbConnection actual;
        //    actual = target.OpenConnection();
        //    Assert.AreEqual(expected, actual);
        //    Assert.Inconclusive("验证此测试方法的正确性。");
        //}

        /// <summary>
        ///NewSqlEncoder 的测试
        ///</summary>
        [TestMethod()]
        public void NewSqlEncoderTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            SqlEncoder expected = null; // TODO: 初始化为适当的值
            SqlEncoder actual;
            actual = target.NewSqlEncoder();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///NewExecutor 的测试
        ///</summary>
        [TestMethod()]
        public void NewExecutorTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            Executor expected = null; // TODO: 初始化为适当的值
            Executor actual;
            actual = target.NewExecutor();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///NewConnection 的测试
        ///</summary>
        [TestMethod()]
        public void NewConnectionTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            DbConnection expected = null; // TODO: 初始化为适当的值
            DbConnection actual;
            actual = target.NewConnection();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///NewCommand 的测试
        ///</summary>
        [TestMethod()]
        public void NewCommandTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            DbCommand expected = null; // TODO: 初始化为适当的值
            DbCommand actual;
            actual = target.NewCommand();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///Initialize 的测试
        ///</summary>
        [TestMethod()]
        public void InitializeTest()
        {
            DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
            string connectionString = string.Empty; // TODO: 初始化为适当的值
            NameValueCollection parameters = null; // TODO: 初始化为适当的值
            target.Initialize(connectionString, parameters);
            Assert.Inconclusive("无法验证不返回值的方法。");
        }

        /// <summary>
        ///CreateExecutor 的测试
        ///</summary>
        [TestMethod()]
        public void CreateExecutorTest()
        {
            //Executor expected = null; // TODO: 初始化为适当的值
            Executor actual;
            actual = DataContext.CreateExecutor();
            //Assert.AreEqual(expected, actual);
            Assert.IsNotNull(actual);
            //Assert.Inconclusive("验证此测试方法的正确性。");
        }

        /// <summary>
        ///CloseConnection 的测试
        ///</summary>
        //[TestMethod()]
        //public void CloseConnectionTest()
        //{
        //    DataContext target = CreateDataContext(); // TODO: 初始化为适当的值
        //    DbConnection connection = null; // TODO: 初始化为适当的值
        //    target.CloseConnection(connection);
        //    Assert.Inconclusive("无法验证不返回值的方法。");
        //}
    }
}
